package com.example.jetpackdemo.utils

import android.content.Context

object UiUtils {
    fun dp2px(content: Context, dpValue: Float): Int {
        val scale = content.resources.displayMetrics.density
        return (dpValue * scale + 0.5f).toInt()
    }

    fun sp2px(content: Context, spValue: Float): Int {
        val fontScale = content.resources.displayMetrics.scaledDensity
        return (spValue * fontScale + 0.5f).toInt()
    }
}